package com.ruoyi.web.controller.system;

import java.util.List;

import com.ruoyi.common.core.domain.entity.RvSecret;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.IRvSecretService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * secret（国家局系统）Controller
 * 
 * @author ess
 * @date 2021-10-18
 */
@RestController
@RequestMapping("/system/rvSecret")
public class RvSecretController extends BaseController
{
    @Autowired
    private IRvSecretService rvSecretService;

    /**
     * 查询secret（国家局系统）列表
     */
    @PreAuthorize("@ss.hasPermi('system:rvSecret:list')")
    @GetMapping("/list")
    public TableDataInfo list(RvSecret rvSecret)
    {
        startPage();
        List<RvSecret> list = rvSecretService.selectRvSecretList(rvSecret);
        return getDataTable(list);
    }

    /**
     * 导出secret（国家局系统）列表
     */
    @PreAuthorize("@ss.hasPermi('system:rvSecret:export')")
    @Log(title = "secret（国家局系统）", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(RvSecret rvSecret)
    {
        List<RvSecret> list = rvSecretService.selectRvSecretList(rvSecret);
        ExcelUtil<RvSecret> util = new ExcelUtil<RvSecret>(RvSecret.class);
        return util.exportExcel(list, "secret（国家局系统）数据");
    }

    /**
     * 获取secret（国家局系统）详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:rvSecret:query')")
    @GetMapping(value = "/{secretId}")
    public AjaxResult getInfo(@PathVariable("secretId") Integer secretId)
    {
        return AjaxResult.success(rvSecretService.selectRvSecretBySecretId(secretId));
    }

    /**
     * 新增secret（国家局系统）
     */
    @PreAuthorize("@ss.hasPermi('system:rvSecret:add')")
    @Log(title = "secret（国家局系统）", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody RvSecret rvSecret)
    {
        return toAjax(rvSecretService.insertRvSecret(rvSecret));
    }

    /**
     * 修改secret（国家局系统）
     */
    @PreAuthorize("@ss.hasPermi('system:rvSecret:edit')")
    @Log(title = "secret（国家局系统）", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody RvSecret rvSecret)
    {
        return toAjax(rvSecretService.updateRvSecret(rvSecret));
    }

    /**
     * 删除secret（国家局系统）
     */
    @PreAuthorize("@ss.hasPermi('system:rvSecret:remove')")
    @Log(title = "secret（国家局系统）", businessType = BusinessType.DELETE)
	@DeleteMapping("/{secretIds}")
    public AjaxResult remove(@PathVariable Integer[] secretIds)
    {
        return toAjax(rvSecretService.deleteRvSecretBySecretIds(secretIds));
    }
}
